# encoding=utf-8

import time
import xmlrpclib

from flask import Flask, render_template
from flask import request, redirect, Blueprint

from cloud_testing.utils import register_ip, query_ip, save_report


# 网络的功能放到这里
network = Blueprint('network', __name__,
                       url_prefix='/network',
                       template_folder='templates',
                       static_folder='static')


@network.route('/route/<name>', methods=['GET', 'POST'])
def net_route(name):
    if name == 'virtio':
        return virtionet_init()
    elif name == 'vmnet':
        return vmnet_init()
    else:
        return render_template('content.html', welcomePage=False)

# 初始化方式
def virtionet_init():
    introduce = {
        'content':u'写上自己需要的内容',
        'method':u'测试方法',
        'setup':u'设置：centos7，wireshark...',
        'testmethod':u'测试方式,点击按钮即可',
        'report':u'报告',
        'picture':'/static/img/openstack.jpg'
        }
    return render_template('content.html', introduce=introduce, welcomePage=False, nav_a=u'数据隔离', nav_b=u'虚拟网卡驱动')

# 初始化方式
def vmnet_init():
    introduce = {
        'content':u'写上自己需要的内容',
        'method':u'测试方法',
        'setup':u'设置：centos7，wireshark...',
        'testmethod':u'测试方式,点击按钮即可',
        'report':u'报告',
        'picture':'/static/img/openstack.jpg'
        }
    return render_template('content.html', introduce=introduce, welcomePage=False, nav_a=u'数据隔离', nav_b=u'VM网络数据包')
